import Vue from 'vue';
import VueRouter from 'vue-router';
import Home from '../views/Home.vue';

import productsChildren from './products.js';
import introduceChildren from './introduce.js';
import contactChildren from './contact.js';
import caseChildren from './case.js';
import stantardChildren from './standard.js';
import newsChildren from './news';

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home
  },
  {
    path: '/introduce',
    name: 'introduce',
    redirect:"/introduce/simple",
    //走进宏源
    // component: () => import(/* webpackChunkName: "about" */ '@/views/introduce/index.vue')
    component: () => import(/* webpackChunkName: "about" */ '@/views/introduce/index.vue'),
    children:[...introduceChildren]
  },
  {
    path: '/news',
    name: 'news',
    redirect:"/news/events",
    component: () => import('@/views/news/index.vue'),
    children:[...newsChildren]
    //新闻
  },
  {
    path: '/products',
    name: 'products',
    component: () => import('@/views/products/index.vue'),
    redirect:"/products/municipal",
    children:[...productsChildren]
    //体系
  },
  {
    path: '/case',
    name: 'case',
    redirect:"/case/minjian",
    component: () => import('@/views/case/index.vue'),
    children:[...caseChildren]
    //案例
  },
  {
    path: '/standard',
    name: 'standard',
    component: () => import('@/views/standard/index.vue'),
    redirect:"/standard/practice",
    children:[...stantardChildren]
    //标准化
  },
  {
    path: '/advantage',
    name: 'advantage',
    redirect:'/advantage/qiye',
    component: () => import('@/views/advantage/index.vue'),
    children:[
      {
        path: '/advantage/qiye',
        name: 'qiye',
        component: () => import('@/views/advantage/qiye.vue'),
      },
      {
        path: '/advantage/product',
        name: 'product',
        component: () => import('@/views/advantage/product.vue'),
      }
    ]
    //优势
  },
  {
    path: '/cooperation',
    name: 'cooperation',
    component: () => import('@/views/cooperation/index.vue')
    //合作
  },
  {
    path: '/contact',
    name: 'contact',
    redirect:"/contact/address",
    component: () => import('@/views/contact/index.vue'),
    children:[...contactChildren]
    //联系方式
  },
]

const router = new VueRouter({
  mode: 'hash',
  base: process.env.BASE_URL,
  routes,
  scrollBehavior (to, from, savedPosition) {
    return { x: 0, y: 0 }
  }
})

export default router
